﻿@using PagedList
@using PagedList.Mvc
@using QqhrCitizen.Models
@model PagedList<QqhrCitizen.Models.User>
@{
    ViewBag.Title = "管理员管理";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<link href="~/Styles/PagedList.css" rel="stylesheet" />
<div>
    <div class="result-title">
        <h1 class="head-tietle">管理员管理 <a href="/Admin/AddManager">增加</a></h1>
    </div>
    <form class="search">
        检索：
        <input type="text" name="Key" class="textbox nullable" placeholder="关键字" />
        <select name="Role" class="textbox nullable">
            <option value="">全部</option>
            <option value="1">商户</option>
            <option value="2">超级管理员</option>
            <option value="3">新闻管理员</option>
            <option value="4">图书管理员</option>
            <option value="5">课程管理员</option>
            <option value="6">连接管理员</option>
        </select>
        <input type="submit" class="btn blue" value="检索" />
    </form>
    <div class="result-content">

        <table class="table">
            <thead>
                <tr>
                    <td>编号</td>
                    <td>用户名</td>
                    <td>真实姓名</td>
                    <td>邮箱</td>
                    <td>电话</td>
                    <td>角色</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
                @if (Model.Count > 0)
                {
                    foreach (var item in Model)
                    {
                        <tr id="@item.ID">
                            <td>@item.ID</td>
                            <td>@item.Username</td>
                            <td>@item.Realname</td>
                            <td>@item.Email</td>
                            <td>@item.Phone</td>
                            <td>@CommonEnums.RoleDisply[@item.RoleAsInt]</td>
                            <td>
                                <a href="/Admin/ManagerShow/@item.ID">详情</a>
                                <a href="javascript:deleteDialog('/Admin/ManagerDelete/' + @item.ID + '?sid=@ViewBag.SID',@item.ID);">删除</a>
                                <a href="/Admin/RoleUpdate/@item.ID">修改权限</a>
                                <a href="/Admin/UpdateManagerPwd/@item.ID">密码重置</a>
                            </td>
                        </tr>
                    }
                }
            </tbody>
        </table>
        @Html.PagedListPager((IPagedList)Model, page => Url.Action("TypeManager", new { page }))
    </div>
</div>


<script>
    function Delete(id) {
        window.location = '/Admin/ManagerDelete/' + id + '?sid=@ViewBag.SID';
    }
</script>

